/*! \file RBTreeImpl.h
 *	\brief <write description for RBTreeImpl.h>
 *
 *	created:	2010/08/27
 *	created:	27:8:2010   16:54
 *	filename: 	C:\src\tactics-engine\libs\core\impl\RBTreeImpl.h
 *	file path:	C:\src\tactics-engine\libs\core\impl
 *	file base:	RBTreeImpl
 *	file ext:	h
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */

#ifndef _core_RBTREEIMPL_H_
#define _core_RBTREEIMPL_H_

#pragma once

#include <core/pair.h>

namespace tt{
namespace core{

namespace impl{

template<typename ValueType>
class RBTreeNode
{
	typedef RBTreeNode<ValueType> Self;
	typedef ValueType value_type;
	typedef typename ValueType::first_type Key;
	typedef typename ValueType::second_type Value;

public:
	enum Color{
		BLACK,
		RED,
	};

public:
	RBTreeNode(Self* parent, const value_type& _value);
	~RBTreeNode();

	bool operator<(const Self& other);
	bool operator==(const Self& other);

	Self* bigest();
	Self* smallest();

	Self* next();
	Self* prev();

public:
	Self* parent;
	Self* left;
	Self* right;
	Color color;

	value_type value;
};

} //namespace impl

} //namespace core
} //namespace tt
#include "RBTreeNode.inl"

#endif //_core_RBTREEIMPL_H_